/*
 * @Descripttion:用户api
 * @LastEditors: xzh
 * @LastEditTime: 2023-08-09 19:19:11
 */
import { object_Inf } from "@/utils/typings/index.type";
import request from "@/utils/request";
import Home_Api from "./home";
import Cookies_Token from "@/utils/cache/cookies/token";

/**
 * @Author: xzh
 * @Descripttion:用户接口类
 * @Param:
 */
export default class User_Api extends Home_Api {
  /**
   * @Author: xzh
   * @Descripttion:获取用户信息
   * @Param:
   */
  static getUserInfo = (): Promise<object_Inf> => {
    let token = new Cookies_Token().get();
    return request({
      url: "/api/User/GetCurrentUserInfo",
      method: "get",
      // params: { token },
    });
  };

  /**
   * @Author: xzh
   * @Descripttion:登录
   * @Param:
   * @param {object} data
   */
  static login = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/Auth/Login",
      method: "post",
      data,
    });

  /**
   * @Author: xzh
   * @Descripttion:退出登录
   * @Param:
   */
  static logout = (account: string) =>
    request({
      url: "/api/Auth/LogOut",
      method: "get",
      params: { account },
    });
}
